home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / IShield for Visual C++ 6.0 / DATA1.CAB / Include_Files / SDCDADV.RUL < prev    next >
Encoding:
Text File  |  1997-11-20  |  7.0 KB  |  173 lines

  1.  
  2.  /*=======================================================================*/
  3.  /*                                                                       */
  4.  /*           (c) InstallShield Software Corporation (1996-1997)          */
  5.  /*            (c)  InstallShield Corporation  (1990-1996)                */
  6.  /*                       Schaumburg, Illinois 60173                      */
  7.  /*                          All Rights Reserved                          */
  8.  /*                           InstallShield (R)                           */
  9.  /*                                                                       */
  10.  /*   File    : sdcdadv.rul                                               */
  11.  /*   Purpose : This file contains the code for the SdComponentDialogAdv  */
  12.  /*             script dialog function.                                   */
  13.  /*                                                                       */
  14.  /*=======================================================================*/
  15.  
  16.  /*------------------------------------------------------------------------*/
  17.  /*                                                                        */
  18.  /*   Function: SdComponentDialogAdv                                       */
  19.  /*                                                                        */
  20.  /*   Descrip:  This dialog will let user choose different parts of the    */
  21.  /*             software to install based on the name and disk space.      */
  22.  /*   Misc:                                                                */
  23.  /*                                                                        */
  24.  /*------------------------------------------------------------------------*/
  25. function SdComponentDialogAdv(szTitle, szMsg, svDir, szComponents)
  26.           STRING  szDlg, szReqSpace, szTemp;
  27.           STRING  svComponent, szFreeSpace, svDirLoc;
  28.           HWND    hwndDlg, hwndListBox, hwndStatic;
  29.           NUMBER  nId, nTemp, nComponentView;
  30.           NUMBER  nReqSpace, nReturn, nvSize;
  31.           BOOL    bDone, bChange;
  32.         begin
  33.  
  34.  
  35.            szDlg     = SD_DLG_COMPONENTDIALOGADV;
  36.            nSdDialog = SD_NDLG_COMPONENTDIALOGADV;
  37.            svDirLoc = svDir;
  38.  
  39.            // record data produced by this dialog
  40.            if (MODE=SILENTMODE) then
  41.              SdMakeName( szAppKey, szDlg, szTitle, nSdComponentDialogAdv );
  42.              SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
  43.              if ((nId != BACK) && (nId != CANCEL)) then
  44.                 SilentReadData( szAppKey, "Component", DATA_COMPONENT, szComponents, nTemp );
  45.                 SilentReadData( szAppKey, "szDir", DATA_STRING, svDir, nTemp );
  46.              endif;
  47.  
  48.              return nId;
  49.            endif;
  50.  
  51.  
  52.            // ensure general initialization is complete
  53.            if (!bSdInit) then
  54.               SdInit();
  55.            endif;
  56.  
  57.            if (EzDefineDialog( szDlg, "", "", SD_NDLG_COMPONENTDIALOGADV ) = DLG_ERR) then
  58.              return -1;
  59.            endif;
  60.  
  61.  
  62.            // Loop in dialog until the user selects a standard button
  63.            bDone = FALSE;
  64.  
  65.            while (!bDone)
  66.  
  67.               nId = WaitOnDialog( szDlg );
  68.  
  69.               switch (nId)
  70.               case DLG_INIT:
  71.  
  72.                    if( szMsg != "" ) then
  73.                        SdSetStatic( szDlg, SD_STA_MSG, szMsg );
  74.                    endif;
  75.  
  76.                    CtrlSetText( szDlg, 0x80000000 | SD_STA_DESTDIR, svDirLoc );
  77.  
  78.                    hwndDlg = CmdGetHwndDlg( szDlg );
  79.                    SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
  80.  
  81.                    if (szTitle != "") then
  82.                        SetWindowText(hwndDlg, szTitle);
  83.                    endif;
  84.  
  85.                    nComponentView = SdCreateComponentView( hwndDlg, SD_LISTBOX, szComponents, svDirLoc );
  86.                    if (!nComponentView) then
  87.                        SdError( -1, "SdComponentDialogAdv" );
  88.                        nId = -1;
  89.                        bDone = TRUE;
  90.                    endif;
  91.  
  92.                    ComponentViewRefresh( nComponentView, 0 );
  93.  
  94.                    hwndListBox = GetDlgItem( hwndDlg, SD_LISTBOX );
  95.                    SetFocus( hwndListBox );
  96.  
  97.  
  98.               case SD_PBUT_CHANGEDIR:
  99.                    nTemp = MODE;
  100.                    MODE  = NORMALMODE;
  101.                    SelectDir( "", "", svDirLoc, TRUE );
  102.                    CtrlSetText( szDlg, 0x80000000 | SD_STA_DESTDIR, svDirLoc );
  103.                    ComponentViewSetInfo( nComponentView, COMPONENT_VIEW_TARGETLOCATION, 0,  svDirLoc );
  104.                    ComponentViewRefresh( nComponentView, 0 );
  105.                    MODE = nTemp;
  106.  
  107.               case SD_PBUT_DISKSPACE:
  108.                    CtrlGetText( szDlg, SD_SPACEAVI, szFreeSpace );
  109.                    CtrlGetText( szDlg, SD_SPACEREQ, szReqSpace );
  110.                    SdDiskSpace( svDirLoc, szFreeSpace, szReqSpace, bChange );
  111.  
  112.                    if( bChange = TRUE ) then
  113.                       CtrlSetText( szDlg, 0x80000000 | SD_STA_DESTDIR, svDirLoc );
  114.                       hwndStatic = GetDlgItem( hwndDlg, SD_SPACEAVI );
  115.                       if (hwndStatic) then
  116.                             SetWindowText( hwndStatic, szFreeSpace );
  117.                             ComponentViewSetInfo( nComponentView, COMPONENT_VIEW_TARGETLOCATION, 0,  svDirLoc );
  118.                       endif;
  119.                       ComponentViewRefresh( nComponentView, 0 );
  120.                    endif;
  121.  
  122.               case SD_PBUT_OK:
  123.                    if( StrCompare(svDirLoc,"") && !SdComponentDlgCheckSpace( szComponents, szDlg, svDirLoc ) ) then
  124.                       MessageBox( szSdStr_NotEnoughSpace, WARNING );
  125.                    else
  126.                       svDir = svDirLoc;
  127.  
  128.                       nId   = OK;
  129.                       bDone = TRUE;
  130.  
  131.                    endif;
  132.  
  133.                    svDir = svDirLoc;
  134.                    nId   = OK;
  135.                    bDone = TRUE;
  136.               case BACK:
  137.                    nId    = BACK;
  138.                    bDone  = TRUE;
  139.  
  140.               case DLG_ERR:
  141.                    SdError( -1, "SdComponentDialogAdv" );
  142.                    nId   = -1;
  143.                    bDone = TRUE;
  144.  
  145.               case DLG_CLOSE:
  146.                   SdCloseDlg( hwndDlg, nId, bDone );
  147.  
  148.               default:
  149.                    // check standard handling
  150.                   if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
  151.                       bDone = TRUE;
  152.                   endif;
  153.               endswitch;
  154.  
  155.            endwhile;
  156.  
  157.            EndDialog( szDlg );
  158.            ReleaseDialog( szDlg );
  159.            ComponentViewDestroy( nComponentView );
  160.  
  161.            SdUnInit();
  162.  
  163.            // record data produced by this dialog
  164.            SdMakeName( szAppKey, szDlg, szTitle, nSdComponentDialogAdv );
  165.            SilentWriteData( szAppKey, "szDir", DATA_STRING, svDir, nTemp );
  166.            SilentWriteData( szAppKey, "Component", DATA_COMPONENT, szComponents, nTemp );
  167.            SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
  168.  
  169.            return nId;
  170.  
  171.         end;
  172.  
  173.